package tr.edu.metu.is.mega.server.service;

import java.util.List;

import tr.edu.metu.is.mega.client.service.GwtScheduleService;
import tr.edu.metu.is.mega.common.dto.ScheduleTemplateDTO;
import tr.edu.metu.is.mega.server.business.ScheduleTemplateManager;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * Implementation of GWT schedule service.
 */
public class GwtScheduleServiceImpl extends RemoteServiceServlet implements GwtScheduleService {

    private static final long serialVersionUID = 154368026669518935L;

    private ScheduleTemplateManager scheduleTemplateManager = null;

    /**
     * Default constructor.
     */
    public GwtScheduleServiceImpl() {
        scheduleTemplateManager = new ScheduleTemplateManager();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ScheduleTemplateDTO createSchedule(ScheduleTemplateDTO scheduleTemplate) {
        return scheduleTemplateManager.createScheduleTemplate(scheduleTemplate);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ScheduleTemplateDTO updateSchedule(ScheduleTemplateDTO scheduleTemplate) {
        return scheduleTemplateManager.updateScheduleTemplate(scheduleTemplate);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void deleteSchedule(ScheduleTemplateDTO scheduleTemplate) {
        scheduleTemplateManager.deleteScheduleTemplate(scheduleTemplate);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ScheduleTemplateDTO> getScheduleTemplates() {
        return scheduleTemplateManager.getScheduleTemplates();
    }
}
